package com.xpqh.ksg.config;

import com.xpqh.ksg.config.properties.RestProperties;
import com.xpqh.ksg.filter.AuthFilter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 加在
 *
 * @author lizhihui
 * @date 2025.03.21
 */
@Configuration
public class SecurityConfig {

    /**
     * 将JWT过滤器添加到 Spring Security 过滤器链
     * @return
     */
    @Bean
    @ConditionalOnProperty(prefix = RestProperties.REST_PREFIX, name = "auth-open", havingValue = "true", matchIfMissing = true)
    public AuthFilter jwtAuthenticationTokenFilter() {
        return new AuthFilter();
    }

}
